import Vue from 'vue'
import Router from 'vue-router'
import Index from '@/components/Index'
import Login from '@/components/Login'
import Oper from '@/components/Oper'
import Prop from '@/components/Prop'
import Dat from '@/components/Dat'
import Conf from '@/components/Conf'
import Cars from '@/components/Cars'
import CarDoings from '@/components/CarDoings'
import Equipment from '@/components/Equipment'
import Equi from '@/components/Equi'
import Warning from '@/components/Warning'
import Yun from '@/components/Yun'
import Zong from '@/components/Zong'
import Pei from '@/components/Pei'
import Shu from '@/components/Shu'
import Wu from '@/components/Wu'
import Visitor from '@/components/Visitor'
import Building from '@/components/Building'
import PublicResource from '@/components/PublicResource'
import VisitorAccess from '@/components/VisitorAccess'
import Operation from '@/components/Operation'
import Carpay from '@/components/Carpay'
import Customer from '@/components/Customer'
import Contracts from '@/components/Contracts'
import Enterprise from '@/components/Enterprise'
import Follow from '@/components/Follow'
import Staffs from '@/components/Staffs'


Vue.use(Router)

//防止重复点击导航 路由重定向报错
const originalPush = Router.prototype.push
Router.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}


export default new Router({
  routes: [
    {
      path: '/',
      name: 'Login',
      component: Login
    },
    {
      path: '/Index',
      name: 'Index',
      component: Index,
      children:[
        {
          path: '/Oper',
          name: 'Oper',
          component: Oper
        },{
          path: '/Building',
          name: 'Building',
          component: Building
        },{
          path: '/PublicResource',
          name: 'PublicResource',
          component: PublicResource
        },
        {
          path: '/Prop',
          name: 'Prop',
          component: Prop,
        },
        {
          path: '/Customer',
          name: 'Customer',
          component: Customer,
        },
        {

          path: '/Follow',
          name: 'Follow',
          component: Follow,
        },
        {
          path: '/Dat',
          name: 'Dat',
          component: Dat
        },
        {
          path: '/Carpay',
          name: 'Carpay',
          component: Carpay
        },
        {
          path: '/Conf',
          name: 'Conf',
          component: Conf
        },
        {
          path: '/Cars',
          name: 'Cars',
          component: Cars
        },
        {
          path: '/CarDoings',
          name: 'CarDoings',
          component: CarDoings
        },
        {
          path: '/Visitor',
          name: 'Visitor',
          component: Visitor
        },
        {
          path: '/VisitorAccess',
          name: 'VisitorAccess',
          component: VisitorAccess
        },
        {
          path: '/Yun',
          name: 'Yun',
          component: Yun
        },
        {
          path: '/Zong',
          name: 'Zong',
          component: Zong
        },
        {
          path: '/Wu',
          name: 'Wu',
          component: Wu
        },
        {
          path: '/Shu',
          name: 'Shu',
          component: Shu
        },
        {
          path: '/Pei',
          name: 'Pei',
          component: Pei
        },
        {
          path: '/Cars',
          name: 'Cars',
          component: Cars
        },
        {
          path: '/Equipment',
          name: 'Equipment',
          component: Equipment,
          children:[
            {
              path: '/Equi',
              name: 'Equi',
              component: Equi
            },
            {
              path: '/Warning',
              name: 'Warning',
              component: Warning
            },
            {
              path: '/Operation',
              name: 'Operation',
              component: Operation
            }
          ]
        },

        {
          path: '/Contracts',
          name: 'Contracts',
          component: Contracts
        },
        {
          path: '/Enterprise',
          name: 'Enterprise',
          component: Enterprise
        },
        {
          path: '/Staffs',
          name: 'Staffs',
          component: Staffs
        }
      ]
    }
  ]
})
